<?php

namespace core\middleware;

use Webman\Http\Request;
use Webman\Http\Response;
use Webman\MiddlewareInterface;

class CheckSite implements MiddlewareInterface
{
    public function process(Request $request, callable $handler): Response
    {
        $controllers =  explode('/', get_controller());
        if ($controllers[0] != 'install') {

            $nowsiteinfo = now_site();
            request()->nowsiteinfo = $nowsiteinfo;
            request()->nowsiteid = $nowsiteinfo['id'];
        }
        return $handler($request);
    }
}
